package practice;

import java.util.Arrays;
import java.util.Scanner;

/**
 * 贪心歌手
 */
public class GreedySinger {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (true) {
            int[] first = Arrays.stream(sc.nextLine().split(" "))
                    .mapToInt(Integer::parseInt)
                    .toArray();
            // 总天数
            int t = sc.nextInt();
            // 经过的城市总数
            int n = sc.nextInt();
            // 每两座城市之间耗费的时间
            int sumCostTime = 0;
            int[] costTime = new int[n + 1];
            for (int i = 0; i <= n; i++) {
                costTime[i] = sc.nextInt();
                sumCostTime += costTime[i];
            }
            for (int i = 0; i < n; i++) {

            }
        }
    }

    private static int sum(int[] arr, int start, int end) {
        int sum = 0;
        for (int i = start; i < end; i++) {
            sum += arr[i];
        }
        return sum;
    }


    public static int calculateMaxIncome(int T, int N, int[] travelTimes, int[][] cityIncomes) {
        // 初始化最大收入数组，长度为总天数T+1，初始值都为0
        int[] maxIncome = new int[T + 1];
        int n = travelTimes.length;

        // 计算每两座城市之间的最短时间
        int[][] timeMatrix = new int[n][n];
        for (int i = 0; i < n; i++) {
            Arrays.fill(timeMatrix[i], Integer.MAX_VALUE);
            timeMatrix[i][i] = 0;
        }
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {
                timeMatrix[i][j] = timeMatrix[j][i] = sum(travelTimes, i, j);
            }
        }

        for (int i = 0; i < n; i++) {
            for (int t = T; t >= timeMatrix[0][i]; t--) {
                for (int j = i; j >= 0; j--) {
                    if (t >= timeMatrix[j][i]) {
                        maxIncome[t] = Math.max(maxIncome[t], maxIncome[t - timeMatrix[j][i]] + cityIncomes[i][0] - cityIncomes[i][1] * (t - timeMatrix[j][i]));
                    }
                }
            }
        }

        return maxIncome[T];
    }
}
